<?php
/**
 * Created by PhpStorm.
 * User: sunzexin
 * Date: 2018/1/10
 * Time: 09:51
 */

namespace App\Http\Controllers\Admin;


use App\Http\Logics\Admin\AdminLogic;
use App\Http\Traits\AdminTrait;
use App\Http\Controllers\BaseController;

class AdminController extends BaseController
{
    use AdminTrait;
    public function login()
    {
        $email = $this->email;
        $password = $this->password;
        $data = [
            'email' => $email,
            'password' => $password
        ];
        $response = AdminLogic::login($data);
        if ($response->code){
            return $this->response($response->code, $response->message);
        }
        return $this->response($response->code, $response->message, $response->data);
    }

    public function getAdminInfo()
    {
        $admin = [
            'roles' => ['admin'],
            'token' => 'admin',
            'introduction' => '我是超级管理员',
            'avatar' => 'https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif',
            'name' => 'Super Admin'
        ];
        $token = $this->token;
        return json_encode($admin);
    }

    public function logout()
    {

    }
}